
#include "meaningdialog.h"

#include <QLabel>
#include <QVBoxLayout>
#include <QMenu>
#include <QAction>
//#include <QApplication>
#include <QScrollArea>

MeaningDialog::MeaningDialog(QWidget *parent) :
	QDialog(parent)
{
	label = new QLabel();
	label->setTextFormat(Qt::RichText);
	label->setAlignment(Qt::AlignTop);
	label->setWordWrap(true);

	QScrollArea *sa = new QScrollArea();  //(this);
	sa->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
//	sa->setBackgroundRole(QPalette::Dark);	// for testing purposes
	sa->setWidget(label);
	sa->setWidgetResizable(true);

	// Create Exit CBA
	QAction *backButton = new QAction(tr("Back"), this);
	backButton->setSoftKeyRole(QAction::NegativeSoftKey);
	connect(backButton, SIGNAL(triggered()), this, SLOT(close()));
	addAction(backButton);

	QVBoxLayout *vl = new QVBoxLayout(this);
	vl->setContentsMargins(0, 0, 0, 0);
//	vl->addSpacing(10);
	vl->addWidget(sa);

	setLayout(vl);
	setWindowState(Qt::WindowMaximized);
	setStyleSheet("QLabel { padding: 5px }");
}

void MeaningDialog::setText(QString text)
{
	label->setText(text);
}
